package com.smart.service.impl;

import java.util.List;
import java.util.ArrayList;
import com.smart.vo.Vo;
import com.smart.vo.Dto;
import java.io.Serializable;
import com.smart.service.BasicService;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @author lgb
 * @date 2020年6月18日 上午11:34:45
 * Copyright (C) 深圳工勘科技
 * @说明: @param <V>
 * @说明: @param <T>
 * @说明: @param <ID>
 **/
public class BasicServiceImpl<V extends Vo,T extends Serializable,ID extends Dto> 
			extends ServiceImpl<BaseMapper<T>,T> implements BasicService<V,T,ID>{
	
	@Override
	public V findById(ID id) {
		T t = getById(id.getId());
		V v = null;
		BeanUtils.copyProperties(t,v);
		return v;
	}

	@Override
	public List<V> findList() {
		List<V> vlist = new ArrayList<V>();
		QueryWrapper<T> wrapper = new QueryWrapper<>();
		wrapper.eq("", "");
		wrapper.notIn("","");
		List<T> list = baseMapper.selectList(wrapper);
		if(!list.isEmpty()){
			for(T it : list){
				V v = null;
				BeanUtils.copyProperties(it,v);
				vlist.add(v);
			}
		}
		return vlist;
	}
	
	

}